<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\cms\controller;

use plugin\saiadmin\basic\BaseController;
use app\cms\logic\ProjectMeetingInvitationSpeakerLogic;
use app\cms\logic\SpeakerLogic;
use app\cms\validate\ProjectMeetingInvitationSpeakerValidate;
use support\Request;
use support\Response;

/**
 * 邀请阶段控制器
 */
class ProjectMeetingInvitationSpeakerController extends BaseController
{
    /**
     * 构造函数
     */
    public function __construct()
    {
        $this->logic = new ProjectMeetingInvitationSpeakerLogic();
        $this->validate = new ProjectMeetingInvitationSpeakerValidate;
        parent::__construct();
    }

    /**
     * 数据列表
     * @param Request $request
     * @return Response
     */
    public function index(Request $request): Response
    {
        $where = $request->more([
            ['speaker_name', ''],
            ['speaker_email', ''],
            ['meeting_type', ''],
            ['project_id', ''],
            ['project_meeting_id', ''],
        ]);
        $query = $this->logic->search($where);
        $data = $this->logic->getList($query);
        return $this->success($data);
    }

    /**
     * 邀请阶段-添加邀请-外讲下拉菜单
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-08-20
     * @return void
     */
    public function getSpeaker()
    {
        $logic = new SpeakerLogic();
        $data = $logic->where('status', 1)->field('id,name,email,title')->order('id desc')->select();
        return $this->success($data);
    }
}
